package com.lg;

import java.util.HashSet;
import java.util.Set;

public class OnceNumber {

    public static void main(String[] args) {
        int[] arr = {2, 6, 8, 9, 6, 4, 2, 5, 7};
        int[] arr1 = {1, 2, 3};
        isAllNumOnce(arr);
        isAllNumOnce(arr1);
    }

    private static void isAllNumOnce(int[] arr) {
        Set<Integer> set = new HashSet<>(arr.length);
        for (int i : arr) {
            set.add(i);
        }
        if (set.size() == arr.length) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}
